//
//  DeleteCollectionViewCell.m
//  B项目
//
//  Created by lanou on 15/12/24.
//  Copyright © 2015年 tzf. All rights reserved.
//

#import "DeleteCollectionViewCell.h"

@implementation DeleteCollectionViewCell
- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        _mainImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,kWidth / 2 - 15, kWidth / 2 - 13.5)];
        
        _deleteImage = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,60,60)];
        
        _titleLable = [[UILabel alloc]initWithFrame:CGRectMake(15, kWidth / 2 - 15 , kWidth / 2 - 40, 60)];
        _titleLable.font = [UIFont systemFontOfSize:15];
        _titleLable.textColor = [UIColor darkGrayColor];
        _titleLable.numberOfLines = 0;
        
        _moneyLable = [[UILabel alloc]initWithFrame:CGRectMake(10, self.mainImage.frame.size.height + 56 , 100, 20)];
        _moneyLable.font = [UIFont systemFontOfSize:16];
        _moneyLable.textColor = kThemeColor;
        
        _heartImage = [[UIImageView alloc]initWithFrame:CGRectMake(self.mainImage.frame.size.width - 70 , self.mainImage.frame.size.height + 60, 15, 15)];
        _numLable = [[UILabel alloc]initWithFrame:CGRectMake(self.heartImage.frame.origin.x + 20, self.mainImage.frame.size.height + 57, 60, 20)];
        _numLable.font = [UIFont systemFontOfSize:15];
        _numLable.textColor = [UIColor darkGrayColor];
        
        [self.contentView addSubview:_mainImage];
        [self.contentView addSubview:_titleLable];
        [self.contentView addSubview:_moneyLable];
        [self.contentView addSubview:_heartImage];
        [self.contentView addSubview:_numLable];
        [self.mainImage addSubview:_deleteImage];
        self.layer.cornerRadius = 5;
        self.layer.masksToBounds = YES;
        
        
    }
    return self;
}
- (void)setChoose:(ChooseGift *)choose{
    if (_choose != choose) {
        _choose = choose;
        self.mainImage.image = [UIImage imageNamed:@"zhanweipic.jpg"];
        NSURL *url = [NSURL URLWithString:choose.cover_image_url];
        //        NSData *data = [NSData dataWithContentsOfURL:url];
        //        self.mainImage.image = [UIImage imageWithData:data];
        
        [self.mainImage sd_setImageWithURL:url];
        [self.mainImage setImageWithURL:url];
        self.titleLable.text = choose.name;
        NSString *money = [NSString stringWithFormat:@"¥%@",choose.price];
        self.moneyLable.text = money;
        self.heartImage.image = [UIImage imageNamed:@"赞_touch-28px.png"];
        
        self.numLable.text = choose.favorites_count;
        self.deleteImage.image = [UIImage imageNamed:@"1128280.gif"];
    }
}

@end
